export function createWebsocket(url, onOpen, onMessage) {
	const socket = new WebSocket(url);
	socket.onopen = onOpen;
	socket.onmessage = onMessage;
	socket.onclose = defaultOnClose;
	socket.onerror = defaultOnError;
	return socket;
}

export function defaultOnClose(ws, event) {
	console.log('ws关闭默认调用方法');
}

export function defaultOnError(ws, event) {
	console.log('ws发生错误默认调用方法');
}
